import {
  initTypeUpAreaListService,
  submitPriceGroupByEditGroupService,
  submitPriceGroupByWaitedPriceService,
  submitPriceGroupByWaitingPriceService,
  getByProductUuidService,
  getByOperService,
  submitGroupReferByWaitingPriceService,
  submitGroupReferByBatchAddPriceService,
  submitGroupReferByEditPriceTypeService,
  submitGroupReferByEditGroupService
} from '@/api/finance/common/salePrice';

import { SALE_PAGE_NAMES } from '@/constants/commodity';

export { SALE_PAGE_NAMES }

// 价格组设置API
export const GROUP_SETTING_API = {
  [SALE_PAGE_NAMES.ADD]: {
    search: initTypeUpAreaListService,
    submit: submitPriceGroupByWaitingPriceService
  },
  [SALE_PAGE_NAMES.ADD_WAITING]: {
    search: initTypeUpAreaListService,
    submit: submitPriceGroupByWaitingPriceService
  },
  [SALE_PAGE_NAMES.BATCH_ADD]: {
    search: initTypeUpAreaListService,
    submit: submitPriceGroupByWaitedPriceService
  },
  [SALE_PAGE_NAMES.EDIT_TYPE]: {
    search: initTypeUpAreaListService,
    submit: submitPriceGroupByWaitedPriceService
  },
  [SALE_PAGE_NAMES.EDIT_GROUP]: {
    search: initTypeUpAreaListService,
    submit: submitPriceGroupByEditGroupService
  }
}

// 价格组参照关系设置API
export const REFER_SETTING_API = {
  [SALE_PAGE_NAMES.ADD]: {
    search: getByProductUuidService,
    submit: submitGroupReferByWaitingPriceService
  },
  [SALE_PAGE_NAMES.ADD_WAITING]: {
    search: getByProductUuidService,
    submit: submitGroupReferByWaitingPriceService
  },
  [SALE_PAGE_NAMES.BATCH_ADD]: {
    search: getByOperService,
    submit: submitGroupReferByBatchAddPriceService
  },
  [SALE_PAGE_NAMES.EDIT_TYPE]: {
    search: getByOperService,
    submit: submitGroupReferByEditPriceTypeService
  },
  [SALE_PAGE_NAMES.EDIT_GROUP]: {
    search: getByOperService,
    submit: submitGroupReferByEditGroupService
  }
}
